-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Disable Global Continuation Lists option #16421
Conversation
8fed167
to
babaa45
Compare
@@ -331,7 +331,7 @@ MM_MarkingSchemeRootClearer::scanContinuationObjects(MM_EnvironmentBase *env) | |||
} else { | |||
/* object was not previously marked */ | |||
gcEnv->_markJavaStats._continuationCleared += 1; | |||
VM_VMHelpers::cleanupContinuationObject((J9VMThread *)env->getLanguageVMThread(), object); | |||
VM_VMHelpers::cleanupContinuationObject((J9VMThread *)env->getLanguageVMThread(), object, (MM_GCExtensions::verify_continuation_list == _extensions->continuationListOption)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really necessary? wouldn't shouldScanContinuationObjects return false (since the lists are empty)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, I was hasty... this is about passing verify not about disabling
runtime/oti/VMHelpers.hpp
Outdated
{ | ||
#if JAVA_SPEC_VERSION >= 19 | ||
vmThread->javaVM->internalVMFunctions->freeContinuation(vmThread, objectPtr); | ||
if (verifyOnly) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's 'only'. you also have to free it up in verify mode, otherwise there is a leak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for verify mode usage, we assume there is no case we can free up, so we assert when we find a case to free up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, you are right, I was wrong.
this is GC path only (I was probably thinking we are in a common path, that last unmount uses, too)
runtime/oti/VMHelpers.hpp
Outdated
vmThread->javaVM->internalVMFunctions->freeContinuation(vmThread, objectPtr); | ||
if (verifyOnly) { | ||
J9VMContinuation *continuation = J9VMJDKINTERNALVMCONTINUATION_VMREF(vmThread, objectPtr); | ||
assert(NULL == continuation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there an API like Assert_VM_true ? or you could not #include it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding assertion to .hpp
might be problematic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can try to move the method to ContinuationHelpers.cpp
we already attempted this move (most of Continuation specific method should not really be here in a generic VM Helpers file) and there were problems, but still, give a thought/try again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a compiling setting problem to reference from subfolder oti to subfolder vm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- we could pass the mode to freeContinuation, but I'm not very much fan of it (since it's shared with VM path of last unmount)
- since this is GC specific helper, this could (in fact, should) be moved to a GC *.cpp file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't find a good file to move it to, but so far best is base ObjectAccessBarrier
some others are ObjectModel, modronapi, VMInterfaceAPI, GCExtensions, FinalizerSupport...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably the best is ContinuationObjectList, since this is already the list that we iterate just before calling the cleanup
as part of the move, change the signature, so that you pass Env, and the method itself will fetch VMThread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should consider moving needScanStacksForContinuation and various related helpers, too, but not at as a part of this change
runtime/gc_base/modronapi.cpp
Outdated
env->getGCEnvironment()->_continuationObjectBuffer->add(env, object); | ||
if (MM_GCExtensions::disable_continuation_list != MM_GCExtensions::getExtensions(env)->continuationListOption) { | ||
env->getGCEnvironment()->_continuationObjectBuffer->add(env, object); | ||
} | ||
MM_ObjectAllocationInterface *objectAllocation = env->_objectAllocationInterface; | ||
if (NULL != objectAllocation) { | ||
objectAllocation->getAllocationStats()->_continuationObjectCount += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no point in doing this in disable mode
babaa45
to
98340de
Compare
runtime/gc_base/GCExtensions.hpp
Outdated
@@ -337,6 +344,7 @@ class MM_GCExtensions : public MM_GCExtensionsBase { | |||
, minimumFreeSizeForSurvivor(DEFAULT_SURVIVOR_MINIMUM_FREESIZE) | |||
, freeSizeThresholdForSurvivor(DEFAULT_SURVIVOR_THRESHOLD) | |||
, recycleRemainders(true) | |||
, continuationListOption(disable_continuation_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking if we have time to default to verify mode first for a few nights, and then disable it
98340de
to
e9f8bb0
Compare
@@ -62,3 +62,18 @@ MM_ContinuationObjectList::addAll(MM_EnvironmentBase* env, j9object_t head, j9ob | |||
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env); | |||
extensions->accessBarrier->setContinuationLink(tail, previousHead); | |||
} | |||
|
|||
void | |||
MM_ContinuationObjectList::cleanupContinuationObject(MM_EnvironmentBase* env, j9object_t objectPtr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that this has a context (class scope) we can drop Continuation from the name.
we can also add Native in the name, but up to you. for example:
releaseNativesForObject
env->_markVLHGCStats._continuationCleared += 1; | ||
list->cleanupContinuationObject(env, object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a static method and called with just a class scope.
like this it gives a false perception that list object is relevant
admittedly, moving this method to this class is not perfect, either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for changing opinions.... but let's just move it to GCExtensions. we already touched it for the processing mode
in that case, the name of the method should still have 'Continuation'
for example releaseNativesForContinuationObject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have name like scanContinuationNativeSlots in various collector Java Delegate classes.
this cleanup method is common for all collectors, hence make sense to be in GCExtensions (which is just a global Java Delegate, although it does not have 'Delegate' in its name).
overall, both place (class owner) and method name is indeed consistent with scanContinuationNativeSlots
runtime/gc_base/modronapi.cpp
Outdated
if (NULL != objectAllocation) { | ||
objectAllocation->getAllocationStats()->_continuationObjectCount += 1; | ||
if (MM_GCExtensions::disable_continuation_list != MM_GCExtensions::getExtensions(env)->continuationListOption) { | ||
MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be before 'if'
e9f8bb0
to
f75c503
Compare
runtime/gc_base/GCExtensions.hpp
Outdated
|
||
if (verify_continuation_list == continuationListOption) { | ||
J9VMContinuation *continuation = J9VMJDKINTERNALVMCONTINUATION_VMREF(vmThread, objectPtr); | ||
Assert_MM_true(NULL == continuation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not add assertions to this .hpp
file. We either move helper to .cpp
file or create special slow path helper for assertion only in .cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or remove assertion obviously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problem keeping it here, but don't know if compiler will have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have particular concern since this is one of top level *hpp files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we had this problem in the past. Any place it is included it should have proper assertions setup. Currently we have no assertions in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you be more specific - we have asserts in some other *hpp files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding assertions to .hpp
file without proper configuring them in this .hpp
file creates hidden assumption (limitation) for environment this method is going to be called - the assertions should be configured there. An attempt to include .h
file required for assertions in this file would cause multiple compilation errors across code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's even does not matter where this method with assertion is called but the fact this code should be compiled everywhere it is included
runtime/oti/VMHelpers.hpp
Outdated
@@ -22,6 +22,7 @@ | |||
|
|||
#if !defined(VMHELPERS_HPP_) | |||
#define VMHELPERS_HPP_ | |||
#include <assert.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
update the title (it's not disabled by default anymore) |
f75c503
to
b3813f8
Compare
runtime/gc_base/GCExtensions.cpp
Outdated
J9VMThread *vmThread = (J9VMThread *)env->getLanguageVMThread(); | ||
|
||
if (verify_continuation_list == continuationListOption) { | ||
J9VMContinuation *continuation = J9VMJDKINTERNALVMCONTINUATION_VMREF(vmThread, objectPtr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
47d27d4
to
d2b0e39
Compare
runtime/gc_base/GCExtensions.cpp
Outdated
#if JAVA_SPEC_VERSION >= 19 | ||
J9VMThread *vmThread = (J9VMThread *)env->getLanguageVMThread(); | ||
|
||
if (verify_continuation_list == getExtensions(env)->continuationListOption) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, just make it a (non-static) member, then
runtime/gc_base/GCExtensions.cpp
Outdated
J9VMContinuation *continuation = J9VMJDKINTERNALVMCONTINUATION_VMREF(vmThread, objectPtr); | ||
Assert_MM_true(NULL == continuation); | ||
} else { | ||
vmThread->javaVM->internalVMFunctions->freeContinuation(vmThread, objectPtr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class should really have javaVM cached
interestingly, it has a javaVM() helper (that fetches it from omrVM each time) and it's used a number of times, but should just be a cached value
but let's be consistent at least and get it using javaVM() helper here, as well (of course, requires this to be a non-static member)
in future, if there is really a hot path that uses it, we can easily find them all and replace with a chashed value
The Continuation Buffers/Lists keep all of "live" Continuation Objects and be maintained by GC in order to free up the related native structure and java stacks in case the Continuation Object has not been terminated normally. currently the global Virtual Thread List will keep all of unterminated Continuation Objects traceable, so Continuation Buffers/Lists are not useful for current case, can disable it by XXgc:disableContinuationList for saving extra scan. cycle. - new XXgc options disableContinuationList, enaleContinuationList, verifyContinuationList -- (default) verify if there is an exceptional case. Signed-off-by: Lin Hu <linhu@ca.ibm.com>
d2b0e39
to
dfdae15
Compare
jenkins compile win,aix jdk19 |
jenkins test sanity xlinux jdk19 |
The Continuation Buffers/Lists keep all of "live" Continuation Objects
and be maintained by GC in order to free up the related native structure
and java stacks in case the Continuation Object has not been terminated
normally.
currently the global Virtual Thread List will keep all of unterminated
Continuation Objects traceable, so Continuation Buffers/Lists are not
useful for current case, can disable it by XXgc:disableContinuationList
for saving extra scan.
cycle.
disableContinuationList,
enaleContinuationList,
verifyContinuationList -- (default) verify if there is an exceptional
case.
Signed-off-by: Lin Hu linhu@ca.ibm.com